#include <iostream>
using namespace std;
class Solution {
public:
    bool isPalindrome(int x) {
		if (x < 0||(x!=0&&x%10==0))
			return false;
		if (x < 10)
			return true;
		int num = 0;
		while(x>num)
		{
			num = num * 10 + x % 10;
			if (x == num)
				return true;
			x /= 10;
		}
		return  (x == num);
    }
};

int main()
{
	Solution sol;
	cout << sol.isPalindrome(888) << endl;
	cout << sol.isPalindrome(12) << endl;
	cout << sol.isPalindrome(9998) << endl;
	cout << sol.isPalindrome(7707) << endl;
	cout << sol.isPalindrome(7007) << endl;
}